package com.philips.util;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;

import com.philips.research.vp.utilities.UtilsVP;

public class Log {
	private final static String logPath=Common.realPath+"log/";
	public static void info(String msg){
		try {
			String nowdate=new SimpleDateFormat("yyyy-MM-dd").format(System.currentTimeMillis());
			FileWriter fw = new FileWriter(logPath+nowdate+"_log.txt", true);
			PrintWriter pw = new PrintWriter(fw); 
			String info="log time : "+nowtime()+"\r\nlog info  : "+msg+"\r\n----------------------------------------\r\n";
            pw.println(info);   
            System.out.println(info);
            pw.close();   //
            fw.close();  
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public static String nowtime(){
		return new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(System.currentTimeMillis());
	}
	public static void main(String[] args) {
		try {
			String a=null;
			a.indexOf("a");
			
		} catch (Exception e) {
			e.printStackTrace();
			info(e.getMessage());
		}
	}
}
